
docute.init({
    landing: 'landing.html',
    plugins: [
        docsearch({
            apiKey: '',
            indexName: 'aplayer',
            tags: ['english', 'zh-Hans'],
            url: 'https://www.cnkker.com'
        }),
        evanyou(),
        player()
    ]
});

function player () {
    return function (context) {
        context.event.on('landing:updated', function () {
            console.log('landing:updated');
            clearPlayer();
          //  aplayer0();
            aplayer1();
            aplayer2();
            aplayer3();
        });
        context.event.on('content:updated', function () {
            console.log('content:updated');
            clearPlayer();
            for (let i = 0; i < document.querySelectorAll('.load').length; i++) {
                document.querySelectorAll('.load')[i].addEventListener('click', function () {
                    window[this.parentElement.id] && window[this.parentElement.id]();
                });
            }
        });
    };
}

function clearPlayer () {
    for (let i = 0; i < 10; i++) {
        if (window['ap' + i]) {
            window['ap' + i].destroy();
        }
    }
}

function aplayer1 () {
    window.ap1 = new APlayer({
        container: document.getElementById('aplayer1'),
        theme: '#F57F17',
        lrcType: 3,
        listMaxHeight:'100%',
        audio: [{
            name: 'A HAT',
            artist: 'A HAT',
            url: 'resource/01/0.A HAT.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'A HAT',
            artist: 'A HAT',
            url: 'resource/01/1.A HAT.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'Sam ran up',
            artist: 'A HAT',
            url: 'resource/01/2.Sam ran up.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'Sam ran down',
            artist: 'A HAT',
            url: 'resource/01/3.Sam ran down.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'Sam ran up',
            artist: 'A HAT',
            url: 'resource/01/4.Sam ran up.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'Sam ran down',
            artist: 'A HAT',
            url: 'resource/01/5.Sam ran down.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'Sam ran up',
            artist: 'A HAT',
            url: 'resource/01/6.Sam ran up.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'Sam ran down',
            artist: 'A HAT',
            url: 'resource/01/7.Sam ran down.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'Sam ran to a hat',
            artist: 'A HAT',
            url: 'resource/01/8.Sam ran to a hat.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'Think and Respond',
            artist: 'A HAT',
            url: 'resource/01/9.0Think and Respond.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'Where does the story take place',
            artist: 'A HAT',
            url: 'resource/01/9.1Where does the story take place.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'Why do you think Sam wants a hat',
            artist: 'A HAT',
            url: 'resource/01/9.2Why do you think Sam wants a hat.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'Which hat would you have picked for yourself Explain',
            artist: 'A HAT',
            url: 'resource/01/9.3Which hat would you have picked for yourself Explain.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'Count the Hats',
            artist: 'A HAT',
            url: 'resource/01/9.4 Count the Hats.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'School-Home Connection',
            artist: 'A HAT',
            url: 'resource/01/9.5 School-Home Connection.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }
        ]
    });
}

function aplayer2 () {
    window.ap1 = new APlayer({
        container: document.getElementById('aplayer2'),
        theme: '#F57F17',
        lrcType: 3,
        listMaxHeight:'100%',
        audio: [{
            name: 'Go Cat',
            artist: 'Go Cat',
            url: 'resource/02/0.Go Cat.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'Go Cat',
            artist: 'Go Cat',
            url: 'resource/02/1.Go Cat.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'Cat ran and ran',
            artist: 'Go Cat',
            url: 'resource/02/2.Cat ran and ran.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'Cat ran in the bag',
            artist: 'Go Cat',
            url: 'resource/02/3.Cat ran in the bag.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'Cat ran and ran',
            artist: 'Go Cat',
            url: 'resource/02/4.Cat ran and ran..mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'Cat ran in the hat',
            artist: 'Go Cat',
            url: 'resource/02/5.Cat ran in the hat.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'Cat ran and ran',
            artist: 'Go Cat',
            url: 'resource/02/6.Cat ran and ran.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'Cat ran in the box',
            artist: 'Go Cat',
            url: 'resource/02/7.Cat ran in the box.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'Go Cat',
            artist: 'Go Cat',
            url: 'resource/02/8.Go Cat!.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'Think and Respond',
            artist: 'Go Cat',
            url: 'resource/02/9.0Think and Respond.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'What does this cat like to do',
            artist: 'Go Cat',
            url: 'resource/02/9.1What does this cat like to do.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'What do you think the cat will do next',
            artist: 'Go Cat',
            url: 'resource/02/9.2What do you think the cat will do next.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'What would you do if you had a cat like',
            artist: 'Go Cat',
            url: 'resource/02/9.3What would you do if you had a cat like.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'Cat Care',
            artist: 'Go Cat',
            url: 'resource/02/9.4Cat Care.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'School-Home Connection',
            artist: 'Go Cat',
            url: 'resource/02/9.5School-Home Connection.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }
        ]
    });
}

function aplayer3 () {
    window.ap1 = new APlayer({
        container: document.getElementById('aplayer3'),
        theme: '#F57F17',
        lrcType: 3,
        listMaxHeight:'100%',
        audio: [{
            name: 'Pat The Cat',
            artist: 'Pat The Cat',
            url: 'resource/03/0.Pat The Cat.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'Pat The Cat',
            artist: 'Pat The Cat',
            url: 'resource/03/1.Pat The Cat.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'Pam can pat the cat',
            artist: 'Pat The Cat',
            url: 'resource/03/2.Pam can pat the cat.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'Dan can pat the cat',
            artist: 'Pat The Cat',
            url: 'resource/03/3.Dan can pat the cat.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'Here come Jan',
            artist: 'Pat The Cat',
            url: 'resource/03/4.Here come Jan.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'Can Lab pat the cat',
            artist: 'Pat The Cat',
            url: 'resource/03/5.Can Lab pat the cat.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'Oh, no',
            artist: 'Pat The Cat',
            url: 'resource/03/6.Oh, no.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'Max ran down',
            artist: 'Pat The Cat',
            url: 'resource/03/7.Max ran down.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'Yes, Max ran in',
            artist: 'Pat The Cat',
            url: 'resource/03/8.Yes, Max ran in.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'Think and Respond',
            artist: 'Pat The Cat',
            url: 'resource/03/9.0Think and Respond.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'Do Pam and Dan pat the cat',
            artist: 'Pat The Cat',
            url: 'resource/03/9.1Do Pam and Dan pat the cat.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'Does Lab pat the cat',
            artist: 'Pat The Cat',
            url: 'resource/03/9.2Does Lab pat the cat.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'What does the cat do when Lab tries to',
            artist: 'Pat The Cat',
            url: 'resource/03/9.3What does the cat do when Lab tries to.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'Why does the cat go in the bag',
            artist: 'Pat The Cat',
            url: 'resource/03/9.4Why does the cat go in the bag.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'What can you tell about dogs and cats',
            artist: 'Pat The Cat',
            url: 'resource/03/9.5What can you tell about dogs and cats.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'How Animals Move',
            artist: 'Pat The Cat',
            url: 'resource/03/9.6How Animals Move.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }, {
            name: 'School-Home Connection',
            artist: 'Pat The Cat',
            url: 'resource/03/9.7School-Home Connection.mp3',
            cover: 'img/music.png',
            lrc: '',
            theme: '#FFFFFF'
        }
        ]
    });
}

